// pages/xinZengDan/order2/order.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    orderCheck: null,
    username: null,
    stepsIndex: 1,
    stepItemCount: 4,
    stepItemContent: [],
    stepItemContent2: [],
    userInfoList: null,
    userCheckList: null
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.setData({
      orderCheck: options.key,
      username: options.username,
      stepItemCount: app.globalData.stepItemCount,
      stepItemContent: app.globalData.stepItemContent,
      stepItemContent2: app.globalData.stepItemContent2,
      shouhuoDizhi: null
    })
    wx.request({
      url: 'https://127.0.0.1:10270/api/userAll',
      method: 'POST',
      timeout: 4000,
      success: (result) => {
        console.log(result);
        this.setData({
          userInfoList: result.data
        })
      },
      fail: (err) => { },
      complete: (res) => { },
    })
  },
  onChange(event) {
    var that = this
    console.log('checkbox', event.detail.value);
    var list = event.detail.value
    console.log(list.toString());
    that.setData({
      userCheckList: list.toString()
    })
  },
  toPageThree: function () {
    var nameStr = this.data.shouhuoDizhi
    nameStr = this.data.userCheckList + ',' + nameStr
    nameStr.replace("，", ",")
    console.log(nameStr);
    // app.globalData.order = {
    //   fahuoren: nameStr,
    // }
    app.globalData.order.fahuoren = nameStr
    wx.navigateTo({
      url: '/pages/xinZengDan/order3/order?key=' + this.data.orderCheck + '&username=' + this.data.username,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})